// const arr = [2,4,5,6,7]

// function higherThanCurrent(scope) {
// 	return scope > 3
// }

// const isTrue = arr.some(higherThanCurrent)

// console.log('isTrue', isTrue) // true

// const isTrue2 = arr.every(higherThanCurrent)

// console.log('isTrue2', isTrue2) // false

// IE6 - IE8兼容性

if (typeof Array.prototype.someDemo != "function") {
  // 函数表达式，fn和context为some传入参数
  Array.prototype.someDemo = function (fn, context) {
  	console.log('context', context)
    var passed = false;
    if (typeof fn === "function") {
      //[5, 8, 3, 10].some(fn, context),this代表原数组
      for (var k = 0, length = this.length; k < length; k++) {
        if (passed === true) break;
        //context绑定fn中this，
        //this[k], k, this为标准回调函数参数value，key，array
        passed = !!fn.call(context, this[k], k, this);
        // passed = fn(this[k]);
    	}
    }
    return passed;
  };
}

var scores = [5, 8, 8, 10];
var current = 7;



const isTrue3 = scores.someDemo(function (score, k, that) {
	console.log('someDemo', that)
	that[0] = 10
  return score < current;
})

console.log(isTrue3)